package com.easyadmin.modules.stock.controller;


import com.easyadmin.common.web.base.BaseController;
import com.easyadmin.modules.stock.service.AiService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author 周厚荣
 * @date 2025/3/31 20:39
 */
@RestController
@RequestMapping("/stock/ai")
public class AiController extends BaseController {

    /**
     * Describe: 基础路径
     */
    private static String MODULE_PATH = "stock/ai/";

    /**
     * Describe: 获取角色列表视图
     * Param ModelAndView
     * Return 用户列表视图
     */
    @GetMapping("main")
    @ApiOperation(value = "获取列表视图")
    @PreAuthorize("hasPermission('/stock/ai/main','stock:ai:main')")
    public ModelAndView main() {
        return jumpPage(MODULE_PATH + "main");
    }


    @Autowired
    private AiService aiService;

    @GetMapping("/sendText/{text}")
    public String sendText(@PathVariable String text) {
        String result = aiService.sendText(text);
        return result;
    }
}
